// pages/healthpoints/healthpoints.js
const api = require('../../util')
const app = getApp()
Page({

    /**
     * 页面的初始数据
     */
    data: {
        statusBarHeight: app.globalData.statusBarHeight,
        list: [],
        integral: 0,
        potop: 0
    },
    // 获取积分
    HealthPoints() {
        var that = this
        api.http('/user/HealthPoints', 'POST', false, {
        }, function (res) {
          if(res.code == 200) {
              that.setData({
                list: res.data
              })
          }
        }) 
    },
    before() {
        wx.navigateBack({
            delta: 1
        })
    },
    todetailed(){
        wx.navigateTo({
          url: '/pages/detailed/detailed',
        })
    },
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {
        var integral = 0
        if (typeof(options.integral)!='undefined'&&options.integral!='undefined') {
            integral = options.integral
        }
        var that = this
        let query = wx.createSelectorQuery()
        query.select('.box').boundingClientRect((rect) => {
            that.setData({
                potop: rect.top
            })
        }).exec()
        this.setData({
            integral
        })
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady() {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow() {
        this.HealthPoints()
    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide() {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload() {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh() {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom() {

    },

    /**
     * 用户点击右上角分享
     */
    // onShareAppMessage() {

    // }
})